<template>
  <div class="compitem">
    <el-radio v-model="radio" label="2" style="margin-left:50px;">图片类广告</el-radio>
    <div class="compname">数量(总)</div>
    <el-input style="width:70px;" v-model="num" type="number"></el-input>
    <div class="compname">个</div>
      <el-radio v-model="radio" label="1">视屏类广告</el-radio>
    <div class="compname">长度(秒)</div>
    <el-input style="width:70px;" v-model="time" type="number" ></el-input>
    

    <!-- <span>长度</span> -->
    <!-- <el-checkbox v-model="checked">{{title}}</el-checkbox> -->
    <!-- <el-input style="width:60px;margin-left:10px;"></el-input> -->
  </div>
</template>
<script>
import { number } from 'echarts/lib/export'
import { param } from '../../../utils'
export default {
  props:{
   title:{
     type:String
   },
   name:{
     type:String
   },
   val:{
     type:String
   },

  },
  data() {
    return {
      radio:'1',
      time:'',
      num:''
    }
  },
  created() {
  // this.radio='2'
  if(this.val){
  var param=JSON.parse(this.val)
    if(param.type==1){
      this.radio=param.type+''
      this.time=param.val
    }else{
       this.radio=param.type+''
      this.num=param.val
    }
  }
  },
  watch: {
    radio:function(params) {
      if(this.radio==1){
        this.$emit('func',{name:this.name,type:this.radio,val:this.time})
      }else{
        this.$emit('func',{name:this.name,type:this.radio,val:this.num})

      }
    },
     num:function(params) {
       if(this.radio==2){
        this.$emit('func',{name:this.name,type:this.radio,val:this.num})
       }
    },
       time:function(params) {
       if(this.radio==1){
        this.$emit('func',{name:this.name,type:this.radio,val:this.time})
       }
    }
  },
}
</script>
<style lang="scss" scoped>
.compitem{
  .compname{
    font-size: 14px;
    // padding: 0 15px;
    padding-right:15px;

  }
  width: 100%;
  display: flex;
   align-items: center;
   margin-right: 20px;
}
</style>